/**
 * 
 */
package com.ubo.graphviz.model.graph.statement;

import java.util.Collection;

import com.ubo.transform.dot.IDotVisitor;


/**
 * @author saludegu
 * 
 */
public class EdgeStmtSubgraph implements IStatement {

	/**
	 * Sous graphe de l'edge.
	 */
	protected final Subgraph mSubgraph;

	/**
	 * EdgeRHS de l'edge.
	 */
	protected final EdgeRHS mEdgeRHS;

	/**
	 * Liste des attributs de l'edge.
	 */
	protected AttributeList mAttributes;

	/**
	 * 
	 * Constructor
	 * 
	 * @param subgraph
	 * @param edgeRHS
	 */
	public EdgeStmtSubgraph(Subgraph subgraph, EdgeRHS edgeRHS) {
		mSubgraph = subgraph;
		mEdgeRHS = edgeRHS;
	}

	/**
	 * Ajout d'un attribut.
	 * 
	 * @param attribute
	 */
	public void addAttribute(Attribute attribute) {
		if (mAttributes == null)
			mAttributes = new AttributeList();
		mAttributes.addAttribute(attribute);
	}

	/**
	 * Ajout d'une collection d'attributs.
	 * 
	 * @param attributes
	 */
	public void addAllAttribute(Collection<Attribute> attributes) {
		if (mAttributes == null)
			mAttributes = new AttributeList();
		mAttributes.addAllAttribute(attributes);
	}

	/**
	 * @return the mAttributes
	 */
	public AttributeList getAttributes() {
		return mAttributes;
	}

	/**
	 * @return the mSubgraph
	 */
	public Subgraph getSubgraph() {
		return mSubgraph;
	}

	/**
	 * @return the mEdgeRHS
	 */
	public EdgeRHS getEdgeRHS() {
		return mEdgeRHS;
	}

	/**
	 * @see com.ubo.graphviz.model.graph.statement.IStatement#generate(com.ubo.transform.dot.IDotVisitor)
	 */
	@Override
	public void generate(IDotVisitor<?> visitor) {
		visitor.generate(this);
	}
}
